<!DOCTYPE html>
<html lang="zh-cn">
	<head>
		<meta charset="utf-8" />
		<base href="<?php echo base_url(); ?>" />
		<!-- 配置文件 -->
		<script type="text/javascript" src="<?php echo base_url();?>ueditor/ueditor.config.js"></script>
		<!-- 编辑器源码文件 -->
		<script type="text/javascript" src="<?php echo base_url();?>ueditor/ueditor.all.js"></script>
		<!-- 语言包文件(建议手动加载语言包，避免在ie下，因为加载语言失败导致编辑器加载失败) -->
		<script type="text/javascript" src="<?php echo base_url();?>ueditor/lang/zh-cn/zh-cn.js"></script>
		<link rel="stylesheet" href="<?php echo base_url();?>ueditor/themes/default/css/ueditor.css"/>
		
		<style>
			body{
			font-size: 15px;
 			    color:#000000;
 			    text-align:center;
 			    text-decoration:none;
 			    width: 1040px;
			}
			table {
    			border-collapse: collapse;
  			    border:solid 1px #abc;
				margin:20px auto;
				width:90%;
				text-align: center;
				float: right;
		    }
			tr {
				border-collapse: collapse;
				border:solid 1px #abc;
				height: 40px;
    		}
			th,td {
 				border-collapse: collapse;
 				border:solid 1px #abc;
  		  	}
		</style>
	</head>
	<body>
		<div id="uu" style="display:none">
			<?php foreach ($allUser as $v): ?>  
				<span><?php echo $v->username;?></span>
			<?php endforeach; ?>
		</div>
		<form action="<?php echo site_url('content/send_mail');?>" method="post">	
		<table border="1" style="margin:0 auto;width:100%;">
			<tr>
				<td colspan='2'>收件人：<input type="text" name="to_who" id="to_who" style="width:650px" value=""/> </td>
			</tr>
			<tr>
				<td>邮件主题：<input type="text" name="title" style="width:650px;" value=""/></td>
			</tr>
			<tr>
				<td colspan='2'style="text-align:center;">
					<div style="width: 100%; align:center;">
						<textarea id="editor_id" name="myContent" style="width:100%;height:440px;">
								
						</textarea>
					</div>
				</td>
			</tr>
			<tr>
				<td colspan='2' style="text-align:center;"><input type="submit" name="submit" onclick="return if_send()" value="发送邮件" /></td>
			</tr>	
		</table>
		</form>	

		<script type="text/javascript">
			var editor = UE.getEditor('editor_id');
		</script>
		
		<script type="text/javascript">
			function if_send(){
				var to_user = document.getElementById('to_who').value.trim();
				
				var spanTag = document.getElementById('uu').getElementsByTagName('span');
				var uName;
				for( var i = 0; true ; i++ ){
					try{
						uName = spanTag[i].innerHTML;
						if(uName == to_user){
							return true;break;
						}
					}catch(e){
						break;
					}
				}
				alert("该用户不存在！！！");
				
				return false;
			}
		</script>
	</body>
</html>	